<%-- 
    Document   : pertanyaan_tawaran_haji
    Created on : Aug 9, 2012, 9:31:25 AM
    Author     : ubuntu
--%>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Pendaftaran Haji</title>
        <script type="text/javascript">
            $(document).ready(function(){
                $('form').submit( function () {
                    document.getElementById("noAkaunPenambah").value = parent.document.getElementById("noAkaun").value;
                    return formValidation(); 
                    
                });
                parent.changeWinDimension();
                <%
                    if(request.getAttribute("ReturnMessages")!= null){                                 
                %>
                    //parent.animateSaving(false);
                    parent.gridHRegLoaed = false;
                    parent.loadGridHReg();
                    parent.dhxWins.window("plusW").close();
                <%
                    }
                %>
                <%   
                    String isEditMode = "false";                    
                    if(request.getAttribute("isEditMode")!= null){
                        isEditMode = (String)request.getAttribute("isEditMode");
                    }
                    String isPrimary = "false";
                    if(request.getAttribute("isPrimary")!= null){
                        isPrimary = (String)request.getAttribute("isPrimary");
                    }                     
                %>
                        
                $('.2').hide(); 
                $('.1').show();
                <%
                    if(isPrimary.equals("false")){
                %>
                    $('.2').show();
                    $('.1').hide();
                <%
                    }
                %>                        
            });
            function tutup(){
                parent.dhxWins.window("plusW").close();
            }

            function validate1(f){
                if(document.getElementById("pertalian").value == ""){
                    alert("Sila pilih pertalian");
                    return false;                     
                }else{
                    f.action = "${pageContext.request.contextPath}/haji/registration?addNewMember";
                    f.submit();
                }
            }
            function validate2(f){
                if(document.getElementById("pertalian").value == ""){
                    alert("Sila pilih pertalian");
                    return false;                     
                }else{
                     f.action = "${pageContext.request.contextPath}/haji/registration?saveEditMember";
                     f.submit();
                }
            }
            function validate3(f){
                if(document.getElementById("noTel1").value == "" && document.getElementById("noTel2").value=="" && document.getElementById("noTel3").value==""){
                    alert("Sila masukkan no telefon");
                    return false;                     
                }else if(document.getElementById("bandar").value == ""){
                    alert("Sila pilih tempat lahir");
                    return false;                     
                }else if(document.getElementById("sekkerja").value == ""){
                    alert("Sila pilih sektor pekerjaan");
                    return false;                     
                }else{
                     f.action = "${pageContext.request.contextPath}/haji/registration?saveEditDetail";
                     f.submit();
                }
            }
            function regextest(evt){
                var theEvent = evt || window.event;
                var key = theEvent.keyCode || theEvent.which;
                key = String.fromCharCode( key );                
                var regex = /^[0-9]+$/;
                if( !regex.test(key) ) {
                  theEvent.returnValue = false;
                  if(theEvent.preventDefault) theEvent.preventDefault();
                }
            }
            
            
        </script>
    </head>
    <body>
        <s:messages/>
        <s:errors/> 
        <br/>
        <s:useActionBean beanclass="th.stripes.util.ListUtil" id="listUtil" />
        <s:form beanclass="th.stripes.action.HajiRegistrationActionBean" id="fPopup">
            <s:hidden name="haji.noAkaun" id="noAkaun"/>
            <s:hidden name="haji.noKp" id="noKp"/>
            <s:hidden name="haji.nama" id="nama"/>
            <s:hidden name="haji.noAkaunPenambah" id="noAkaunPenambah"/>
            <s:hidden name="haji.idMaklumatKeluarga" id="idMaklumatKeluarga"/>
            <s:hidden name="haji.idMohonMaklumat" id="idMohonMaklumat"/>
            <s:hidden name="haji.noTel3"/>
            <!--<div style="z-index: -1">-->
                
            <!--<fieldset style="border-radius: 10px;width: 495px;">-->
            <div id="content" style="width:90%">            
                <div id="logo">
                    <span>
                        <img src="${pageContext.request.contextPath}/images/img/ribbon.png"/>               
                    </span>
                </div>
                <h3>
                    Butir-butir peribadi
                </h3>                  
                <p>
                            <label>No. Akaun TH :</label> ${actionBean.haji.noAkaun}
                </p>
                <p>
                            <label>No. KP Semasa :</label> ${actionBean.haji.noKp} 
                </p>
                <p>
                            <label>Nama :</label> ${actionBean.haji.nama}
                </p>
                
                <p  style="height: 15px;">
                    <label>Alamat :</label>${actionBean.haji.alamat1}        
                </p>
                <p style="height: 15px;">
                    <label>&nbsp; </label>${actionBean.haji.alamat2}         
                </p>
                <p style="height: 15px;">
                    <label>&nbsp; </label>${actionBean.haji.alamat3}         
                </p>
                <p>
                    <label>Poskod :</label>${actionBean.haji.poskod}         
                </p>
                <p>
                    <label>Negeri :</label> ${actionBean.haji.negeri.desc}
                </p>
                <p class="1">
                            <label><font color="red">*</font>No Telefon </label>&nbsp;
                </p>
                <p class="1" style="height: 25px;">
                            <label>Rumah :</label>
                            <s:text name="haji.noTel1" id="noTel1" maxlength="12" onkeypress='regextest(event)'/>&nbsp;                            
                </p>
                <p class="1" style="height: 25px;">
                            <label>Pejabat :</label>
                            <s:text name="haji.noTel2" id="noTel2" maxlength="12" onkeypress='regextest(event)'/>&nbsp;                            
                </p>
                <p class="1" style="height: 25px;">
                            <label>Bimbit :</font></label>
                            ${actionBean.haji.noTel3}&nbsp;                          
                </p>
                <p class="1">
                            <label><font size="1">Sila isi salah satu no. telefon</font><label>
                </p>
                <br>
                <p class="1">
                            <label>No. fax :</label>
                            <s:text name="haji.fax" id="nofax"/>                            
                </p>
                <p class="1">
                            <label>Tempat Lahir :</label>
                            <s:select name="haji.bandar.kod" id="bandar" >
                                        <s:option value="">Sila Pilih</s:option>
                                        <c:forEach items="${listUtil.senaraiBandar}" var="item">
                                                <s:option value="${item.kod}">${item.kod} - ${item.nama}</s:option>
                                        </c:forEach>                                                             
                            </s:select>
                </p>
                <p class="1">
                            <label>Pekerjaan :</label>
                            <s:select name="haji.sektorPekerjaan.kod" id="sekkerja" >
                                        <s:option value="">Sila Pilih</s:option>
                                        <c:forEach items="${listUtil.senaraiSektorPekerjaan}" var="item">
                                                <s:option value="${item.kod}">${item.kod} - ${item.nama}</s:option>
                                        </c:forEach>
                            </s:select> 
                </p>
                <p class="2">
                            <label>Pertalian :</label>
                            <s:select name="haji.hubungan.kod" id="pertalian">
                                        <s:option value="">Sila Pilih</s:option>
                                        <c:forEach items="${listUtil.senaraiHubungan}" var="item">
                                                <s:option value="${item.kod}">${item.kod} - ${item.nama}</s:option>
                                        </c:forEach>
                            </s:select>                    
                </p>
                <p align="center">  
                     <!-- temporarily uncomment button close  -->
                    <%
                    if(isEditMode.equals("true") && isPrimary.equals("true")){
                    %>
                    <s:button name="saveEditDetail" value="Simpan" class="button green" onclick="validate3(this.form)"/>
                    <s:button name="close" value="Tutup" class="button green" onclick="tutup()"/>
                    <%
                    }else if (isEditMode.equals("true") && isPrimary.equals("false")){
                    %>
                    <s:button name="saveEditMember" value="Simpan" class="button green" onclick="validate2(this.form)"/>
                    <s:button name="close" value="Tutup" class="button green" onclick="tutup()"/>
                    <%
                    }else{
                    %>
                    <s:button name="check" value="Simpan" class="button green" onclick="validate1(this.form)"/>       
                    <s:button name="close" value="Tutup" class="button green" onclick="tutup()"/>
                    <%
                    }
                    %>
                </p>
            </div>
            <!--</div>-->
        </s:form>
    </body>
</html>
